/*
 * File Name：TrackBasHeader.java
 * Copyright：Copyright 2008-2012 CiWong.Inc. All Rights Reserved.
 * Description： TrackBasHeader.java
 * Modify By：PLA-ZJLIU
 * Modify Date：2012-12-7
 * Modify Type：Add
 */
package com.ciwong.ciwongwrite.mode;

/**
 * <pre>
 * </pre>
 *
 * @author PLA-ZJLIU
 * @version ciwong v.1.0 2012-12-7
 * @since ciwong v.1.0
 */
public class TrackHeader
{
    private String createTime;// 创建时间

    private float recTime;// 记录时长

    private int width;// 宽度

    private int height;// 高度

    private int bgColor;// 背景颜色

    private int totalFrames;// 总帧数

    public String getCreateTime()
    {
        return createTime;
    }

    public void setCreateTime(String createTime)
    {
        this.createTime = createTime;
    }

    public float getRecTime()
    {
        return recTime;
    }

    public void setRecTime(float recTime)
    {
        this.recTime = recTime;
    }

    public int getWidth()
    {
        return width;
    }

    public void setWidth(int width)
    {
        this.width = width;
    }

    public int getHeight()
    {
        return height;
    }

    public void setHeight(int height)
    {
        this.height = height;
    }

    public int getBgColor()
    {
        return bgColor;
    }

    public void setBgColor(int bgColor)
    {
        this.bgColor = bgColor;
    }

    public int getTotalFrames()
    {
        return totalFrames;
    }

    public void setTotalFrames(int totalFrames)
    {
        this.totalFrames = totalFrames;
    }

    /**
     * 格式化头部
     *
     * @return 格式化
     */
    public String format()
    {
        StringBuilder builder = new StringBuilder();
        builder.append("<Head>");
        builder.append("<" + TrackBase.PARAM_ATTR);
        builder.append(" " + TrackBase.HEADER_NAME_ATTR + "=\""
                + TrackBase.CREATE_TIME + "\"");
        builder.append(" " + TrackBase.HEADER_VALUE + "=\"" + createTime + "\"");
        builder.append("/>");
        builder.append("<" + TrackBase.PARAM_ATTR);
        builder.append(" " + TrackBase.HEADER_NAME_ATTR + "=\""
                + TrackBase.REC_TIME + "\"");
        builder.append(" " + TrackBase.HEADER_VALUE + "=\"" + recTime + "\"");
        builder.append("/>");
        builder.append("<" + TrackBase.PARAM_ATTR);
        builder.append(" " + TrackBase.HEADER_NAME_ATTR + "=\""
                + TrackBase.WIDTH + "\"");
        builder.append(" " + TrackBase.HEADER_VALUE + "=\"" + width + "\"");
        builder.append("/>");
        builder.append("<" + TrackBase.PARAM_ATTR);
        builder.append(" " + TrackBase.HEADER_NAME_ATTR + "=\""
                + TrackBase.HEIGHT + "\"");
        builder.append(" " + TrackBase.HEADER_VALUE + "=\"" + height + "\"");
        builder.append("/>");
        builder.append("<" + TrackBase.PARAM_ATTR);
        builder.append(" " + TrackBase.HEADER_NAME_ATTR + "=\""
                + TrackBase.BG_COLOR + "\"");

        builder.append(" " + TrackBase.HEADER_VALUE + "=\""
                + Integer.toString(bgColor, 16) + "\"");
        builder.append("/>");
        builder.append("</Head>");
        return builder.toString();
    }
}
